/*
Java source file
Copyright: Umschalt.com 2012
*/
package com.david.documentation.service.doku;

import com.david.documentation.domain.AbstractDokusTest;
import com.david.documentation.domain.entities.category.Category;
import com.david.documentation.domain.entities.doku.Doku;
import com.david.documentation.domain.entities.episode.Episode;
import com.david.documentation.domain.entities.link.Link;
import com.david.documentation.domain.entities.tags.Tag;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class DokuServiceTest extends AbstractDokusTest{

	@Autowired
	private DokuService dokuService;

	@Test
	public void testDokuService() throws Exception{

		Doku doku = new Doku();
		doku.setName("TestDoku");
		doku.setDescription("Eine super Doku");
		doku.setDuration("10min");
		doku.setFormat("DVD-RIP");
		doku.setLanguage("DEUTSCH");
		doku.setSize("200MB");
		doku.setUploader("David Leeb");
		doku.setImage_url("Das bild");

		Link link = new Link();
		link.setLink("http://www.friendseek.com");
		doku.setLink(link);

		List<Tag> tags = new ArrayList<Tag>();
		tags.add(new Tag("Reisen"));
		tags.add(new Tag("Sport"));
		doku.setTags(tags);

		List<Category> categories = new ArrayList<Category>();
		categories.add(new Category("Kategorie 1"));
		categories.add(new Category("Kategorie 2"));
		doku.setCategorys(categories);

		List<Episode> episodes = new ArrayList<Episode>();
		episodes.add(new Episode("test1", Collections.EMPTY_LIST));
		episodes.add(new Episode("test2", Collections.EMPTY_LIST));
		doku.setEpisodes(episodes);

		dokuService.save(doku);
	}

}
